class IndustryModel {
  int? id;
  String? name;
  List<IndustryModel>? children;
  String? icon;

  IndustryModel({this.id, this.name, this.children, this.icon});

  factory IndustryModel.fromJson(Map<String, dynamic> json) => IndustryModel(
        id: json['id'] as int?,
        name: json['name'] as String?,
        children: (json['children'] as List<dynamic>?)
            ?.map((e) => IndustryModel.fromJson(e as Map<String, dynamic>))
            .toList(),
        icon: json['icon'] as String?,
      );

  Map<String, dynamic> toJson() => {
        'id': id,
        'name': name,
        'children': children?.map((e) => e.toJson()).toList(),
        'icon': icon,
      };
}
